<?php
$g4_path = '..';
$lib =  "$g4_path/lib.php";
require_once ("$g4_path/common.php");
require_once ($lib);
    if(!isset($_GET['id'])) {
        exit;
    }
    $sql = "SELECT * FROM course WHERE no = {$_GET['id']}";
    $data = mysql_fetch_assoc(mysql_query($sql));
    //var_export($data);
?><html>
<head>
<link href="font.css" rel="stylesheet" type="text/css">
<link href="office.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
        padding : 0;
        margin : 0;
}
.style2 {font-size: 16px}
    <?php
        $style = array();
        if($data['w_mon']) {
            $style[] = 'td.mon';
        }
        if($data['w_tue']) {
            $style[] = 'td.tue';
        }
        if($data['w_wed']) {
            $style[] = 'td.wed';
        }
        if($data['w_thu']) {
            $style[] = 'td.thu';
        }
        if($data['w_fri']) {
            $style[] = 'td.fri';
        }
        if($data['w_sat']) {
            $style[] = 'td.sat';
        }
    
    $class = implode(',', $style); 
    ?>
    <?php echo $class?> {
        background-color : #999;
    }
-->
</style>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
  <tbody><tr> 
    <td height="30" background="images/pop_title_bg.gif" class="font"><img width="82" height="24" src="images/pop_title.gif"/></td>
  </tr>
  <tr> 
    <td height="3" bgcolor="#000000"><img width="1" height="1" src="images/1blank.gif"/></td>
  </tr>
  <tr> 
    <td height="10"><span class="style2"><?php echo $data['name'].' '.date('m')?>월 / <?php echo $data['starttime']++."시~".$data['starttime']."시"; ?></span></td>
  </tr>
  <tr> 
    <td align="center"><table width="100%" cellspacing="0" cellpadding="3" bordercolor="#cccccc" border="2" style="border-collapse: collapse;" class="font">
      <tbody><tr>
        <td width="1" height="40">일</td>
        <td width="1" height="40">월</td>
        <td width="1" height="40">화</td>
        <td width="1" height="40">수</td>
        <td width="1" height="40">목</td>
        <td width="1" height="40">금</td>
        <td width="1" height="40">토</td>
      </tr>
        <?php
            $now = mktime();
            $limit = date('t');
            $today = date('d', $now);
            $firstDom = $now - ($today-1) * 60 * 60 * 24;
            $startDow = date('w', $firstDom);

            $lastWeek = false;
            $days = 1-$startDow;
            $dows = array('sun','mon','tue','wed','thu','fri','sat');
            while(!$lastWeek) :
            ?>
            <tr>
                <?php
                    for($i = 0; $i < 7; $i++, $days++) :
                ?>
                <td width="1" valign="top" height="40" class="<?php echo $dows[$i]?>"><?php if($days >= 1 && $days <= $limit)echo  $days?></td>
                <?php
                    if($days >= $limit) {
                        $lastWeek = true; 
                    }
                    endfor;
                ?>
            </tr>
            <?php
            
            
            endwhile;
            ?>
    </tbody></table></td>
  </tr>
  <tr>
    <td align="center"> </td>
  </tr>
</tbody></table>
</body>
</html>
